package com.imooc.demo.utils;

import com.imooc.demo.vo.PageResultVo;

/**
 * @Auther: 杨通通
 * @Date: 2021/11/8 21:14
 * @Description:
 */
public class PageResultVoUtil {

    public static <T> PageResultVo<T> success(T data,Integer pageIndex,Integer total){
        PageResultVo<T> pageResultVo = new PageResultVo<>();
        pageResultVo.setCode(0);
        pageResultVo.setMsg("成功");
        pageResultVo.setPageIndex(pageIndex);
        pageResultVo.setTotal(total);
        pageResultVo.setData(data);
        return pageResultVo;
    }

    public static <T> PageResultVo<T> fail(Integer code,String message){
        PageResultVo<T> pageResultVo = new PageResultVo<>();
        pageResultVo.setMsg(message);
        pageResultVo.setCode(code);
        return pageResultVo;
    }
}